package szwolaiyun.paireach.com.szwolaizhuang.fragment;

import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import java.util.ArrayList;

import szwolaiyun.paireach.com.szwolaizhuang.R;
import szwolaiyun.paireach.com.szwolaizhuang.adapter.HistoryAdapter;
import szwolaiyun.paireach.com.szwolaizhuang.mode.History;

/**
 * Created by Administrator on 2016/7/21.
 */
public class HistoryFragment extends Fragment{

    private View view;
    private Handler handler;
    private ListView history_listview;
    private HistoryAdapter adapter;
    private ArrayList<History>list=new ArrayList<History>();

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        view=inflater.inflate(R.layout.fragment_history,null);
        initControl();
        return view;
    }
    private void initControl(){
        history_listview=(ListView)view.findViewById(R.id.history_listview);
        setDate();
        adapter=new HistoryAdapter(getActivity(),list);
        history_listview.setAdapter(adapter);
    }
    public void setHandle(Handler handler){
            this.handler=handler;
    }

    void setDate(){
        for (int i=0;i<5;i++){
            History history1=new History();
            history1.setDate("2015-11-09");
            history1.setOrderCode("177636"+i);
            history1.setStartTime("开始：10：00");
            history1.setEndTime("结束：12:00");
            if(i==0){
                history1.setIsShowDate(true);
            }
            list.add(history1);
        }

        for (int i=0;i<5;i++){
            History history1=new History();
            history1.setDate("2015-11-08");
            history1.setOrderCode("177646"+i);
            history1.setStartTime("开始：10：00");
            history1.setEndTime("结束：12:00");
            if(i==0){
                history1.setIsShowDate(true);
            }
            list.add(history1);
        }



    }

}
